import os

from google.appengine.ext import webapp
from google.appengine.ext import db
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template

class TestDB(db.Model):
  vstr = db.StringProperty(multiline = True)

class MainHandler(webapp.RequestHandler):

  def get(self):
    testdb_query = TestDB.all()
    testdbs = testdb_query.fetch(10)
    
    list_values = {
      'testvalues': testdbs
      }
    
    view_vlist_path = os.path.join(os.path.dirname(__file__), 'view/homevlist.htm')
    
    view_main_path = os.path.join(os.path.dirname(__file__), 'view/main.htm')
    
    manage_page = template.render(view_vlist_path, list_values)
    
    view_main_values = {
      'mainpage': manage_page
      }
    
    self.response.out.write(template.render(view_main_path, view_main_values))

def main():
  application = webapp.WSGIApplication([
  ('/', MainHandler)
  ], debug=True)
  util.run_wsgi_app(application)


if __name__ == '__main__':
  main()
